public class text {
    public static void main(String[] args) {
        Animal animal=new Cat("小众","绿色");
        //判断父类是否引用了Dog类
        if(animal instanceof Dog)
        {
            Dog dog=(Dog)animal;
            System.out.println(dog.silly);

        }
    }
    public static void main6(String[] args) {
        Animal animal=new Cat("小众","绿色");
        Dog dog=(Dog)animal;
        System.out.println(dog.silly);
    }
    public static Animal funtion()
    {
        return new Dog("小孙","傻");
    }
    public static void main5(String[] args) {
        Animal animal=funtion();
        animal.eat();
    }
    public static void main4(String[] args) {
        Animal animal=new Cat("小众","绿色");
        Cat cat=(Cat)animal;
        System.out.println(cat.colour);

    }
    public static void sweep(String name,int age)
    {
        System.out.println("两个参数");
    }
    public static void sweep(String name)
    {
        System.out.println("一个参数");
    }
    public static void sweep()
    {
        System.out.println("无参数");
    }
    public static void main3(String[] args) {
        sweep();
        sweep("小海");
        sweep("小中",8);
    }
    public static void fun(Animal animal)
    {
        animal.eat();
    }
    public static void main2(String[] args) {
        fun(new Cat("小众","红色"));
        fun(new Dog("小凯","傻狗"));

    }
    public static void main1(String[] args) {
        Animal animal=new Cat("小众","绿色");

    }
}
